import React,{Component} from 'react';
import { ListGroup, ListGroupItem } from 'reactstrap';
import Carousel from './Carousel'
import {connect} from 'react-redux'
import  { HotNews , HotPro}  from '../actions'
import { NavLink } from 'react-router-dom';
import Ptj from './Ptj'
import Ntj from './Ntj'

const mapStateToProps = (state)=>{
    return {
        ...state.hotnews,
        ...state.hotpro
    }
}
class Home extends Component{
    componentDidMount(){
        this.props.HotNews(); 
        this.props.HotPro();     
    }
    render(){
        const{list,list2,HotNews,HotPro}=this.props;
        return (
            <div >
                <Carousel/>
                <div className="panel panel-success" style={{fontSize:"1.5rem",width:"90%",margin:"50px auto"}}>
                    <div className="panel-footer">商品推荐</div>
                    <div className="panel-body">
                        <Ptj/>
                    </div>
                </div>
                <div className="panel panel-success" style={{fontSize:"1.5rem",width:"90%",margin:"50px auto"}}>
                    <div className="panel-footer">新闻推荐</div>
                    <div className="panel-body">
                    <Ntj/>
                    </div>
                </div>
            </div>
        )
   }
}

export default connect(mapStateToProps,{HotNews , HotPro})(Home);
